package Passenger;

import java.util.Date;

/**
 * Created by Connor Madden.
 * User: Connor Madden
 * Date: 6/10/11
 * Time: 12:33 PM
 */
public class Passenger {
    public enum State {
        WAITING, TRAVELING, DEPARTED
    }

    private String name;
    private int destination;
    private Date departTime;
    private final int arrivalPoint;
    private final Date arrivalTime;
    private State status;

    public Passenger(String name, int destination, int arrivalPoint) {
        this.name = name;
        this.destination = destination;
        this.arrivalPoint = arrivalPoint;
        arrivalTime = new Date();
        status = State.WAITING;
    }

    public String getName() {
        return name;
    }

    public int getDestination() {
        return destination;
    }

    public Date getDepartTime() {
        if (status != State.DEPARTED) {
            return null;
        } else {
            return departTime;
        }
    }

    public int getArrivalPoint() {
        return arrivalPoint;
    }

    public Date getArrivalTime() {
        return arrivalTime;
    }

    public State getStatus() {
        return status;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void travel() {
        this.status = State.TRAVELING;
    }

    public void depart() {
        this.status = State.DEPARTED;
        departTime = new Date();
    }
}
